import Vue from 'vue'

// A modern alternative to CSS resets
import 'normalize.css/normalize.css'

// 导入element-ui
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

// 导入全局css
import '@/styles/index.scss'

import App from './App'
import store from './store'
import router from './router'
import filters from '@/filters'
// icon
import '@/icons'

// 导航守卫
import '@/permission'

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */

// process.dev.NODE_NEV 判断当前环境
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

// 全局注册自定义指令
import directives from '@/directives'
Object.keys(directives).forEach((item) => {
  Vue.directive(item, directives[item])
})

// 全局注册过滤器
Object.keys(filters).forEach((item) => {
  Vue.filter(item, filters[item])
})
// 添加$bus传值
Vue.prototype.$bus = new Vue()

// set ElementUI lang to EN
Vue.use(ElementUI)
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: (h) => h(App)
})
